<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Session 实例</title>
</head>
<body>
	<h1>Session test</h1>

	<table>
		<tr>
			<th>名称</th>
			<th>值</th>
		</tr>
		<tr>
			<td>session Id：</td>
			<td><%=session.getId()%></td>
		</tr>
		<tr>
			<td>session create time:</td>
			<td><%=new Date(session.getCreationTime())%></td>
		</tr>
		<tr>
			<td>session last login time：</td>
			<td><%=new Date(session.getLastAccessedTime())%></td>
		</tr>
		<tr>
			<td>session inactive time：</td>
			<td><%=session.getMaxInactiveInterval()%></td>
		</tr>
	</table>
	<h2>application test</h2>
	<%
		Object obj = application.getAttribute("count");
		if (obj == null) {
			application.setAttribute("count", new Integer(1));
			out.println("该页面被访问了1次");
		} else {
			int countValue = Integer.parseInt(obj.toString());
			countValue++;
			application.setAttribute("count", countValue);
			out.println("该页面被访问了" + countValue + "次");

		}
	%>

</body>
</html>